/*
 * @Author: yaoxue
 * @Date: 2020-03-17 10:29:39
 * @LastEditTime: 2020-03-29 13:15:38
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \smart-community\src\controller\integral.js
 */
import http from "./Common/http.js"
import constant from "@/controller/constant.js"

export default {
  // 根据区编码查询积分简介
  integral_get_one: async function(id) {
    const res = await http.get(
      constant.BASE_URL + "/community/neighborhood/" + id
    )
    return res
  },
  // 本人申报
  // 获取楼栋号 & 他人申请人楼号
  integral_bind_build: async function(id) {
    const res = await http.get(
      constant.BASE_URL + "/community/building/bindBuild/" + id
    )
    return res
  },
  // 获取选择身份
  integral_identity: async function(userId, shequId) {
    const res = await http.get(
      constant.BASE_URL +
        `/userIdentity/v1/findList?userId=${userId}&shequId=${shequId}`
    )
    return res
  },
  // 本人申请申报
  integral_create: async function(data) {
    const res = await http.post(constant.BASE_URL + "/igApply/v1/create", data)
    return res
  },
  // 本人选择类型
  integral_mapNameAndId: async function(id) {
    const res = await http.post(
      constant.BASE_URL + "/igApplyType/v1/mapNameAndIdFront",
      id
    )
    return res
  },
  // 他人申报 楼栋号
  integral_building_neighborhoods: async function(id) {
    const res = await http.get(
      constant.BASE_URL + `/community/building/neighborhoods/${id}`
    )
    return res
  },
  // 他人申报 当事人身份选择   || 积分首页用户身份列表
  integral_identity_choose: async function() {
    const res = await http.get(constant.BASE_URL + `/identity/v1/list`)
    return res
  },
  // 用户身份列表
  // integral_user_ist: async function() {
  //   const res = await http.get(constant.BASE_URL + `/identity/v1/list`)
  //   return res
  // },
  //  积分页列表
  integral_identityList: async function(pageSize, curPage, identityId) {
    const res = await http.get(
      constant.BASE_URL +
        `/userIdentity/v1/front/page/${pageSize}/${curPage}?identityId=${identityId}`
    )
    return res
  },
  // 我的申报
  integral_my_declare: async function(data) {
    const res = await http.post(
      constant.BASE_URL + "/igApply/v1/page/front",
      data
    )
    return res
  },
  // 我的审核
  integral_my_audit: async function(data) {
    const res = await http.post(
      constant.BASE_URL + "/igApply/v1/page/front/audit",
      data
    )
    return res
  },
  // 公开栏列表
  integral_public_list: async function(id, data) {
    const res = await http.post(
      constant.BASE_URL + `/igApply/v1/page/public/${id}`,
      data
    )
    return res
  },
  // 公开栏列表详情
  integral_public_list_detatil: async function(id) {
    const res = await http.get(constant.BASE_URL + `/igApply/v1/get/${id}`)
    return res
  },
  // 点赞
  integral_like: async function(data) {
    const res = await http.post(
      constant.BASE_URL + `/igApplyFavorite/v1/create`,
      data
    )
    return res
  },
  // 取消点赞
  integral_like_cancel: async function(data) {
    const res = await http.post(
      constant.BASE_URL + `/igApplyFavorite/v1/cancel`,
      data
    )
    return res
  },
  // 举报
  integral_inform: async function(data) {
    const res = await http.post(constant.BASE_URL + `/igReport/v1/create`, data)
    return res
  },
  // 栋楼长修改
  integral_edit_builder: async function(data) {
    const res = await http.post(
      constant.BASE_URL + `/igApply/v1/audit/builder`,
      data
    )
    return res
  },
  // 他人申报姓名选择
  integral_builderUsers: async function(data) {
    const res = await http.post(
      constant.BASE_URL + `/igApply/v1/list/builderUsers`,
      data
    )
    return res
  },
  // 我的积分tab
  integral_findOwn: async function() {
    const res = await http.get(constant.BASE_URL + `/userIdentity/v1/findOwn`)
    return res
  },
  //  我的积分
  integral_record_list: async function(data) {
    const res = await http.post(
      constant.BASE_URL + `/igChangeLogs/v1/page/record/front`,
      data
    )
    return res
  },
  // 我的积分详情
  integral_record_list_detatil: async function(id) {
    const res = await http.get(constant.BASE_URL + `/igChangeLogs/v1/get/${id}`)
    return res
  }
}
